<?php
header('Content-Type:text/html; Charset=UTF-8');
require 'lib/checker.php';

require 'lib/db.php';

@$type = dbSelectAll('select id,name from type order by id asc');

require 'lib/header.php';
?>
		<div class="container">
            <div class="row">
                <div class="col-xs-2">
                    <div class="form-group">
                        <div class="input-group">
                            <a href="dishTypeAdd.php" class="btn btn-primary btn-lg btn-block">添加菜品类型</a>
                            <a href="main.php" class="btn btn-primary btn-lg btn-block">返回首页</a>
                        </div>
                    </div>
                </div>
                <div class="col-xs-5">
	                <div class="panel panel-primary">
                            <div class="panel-heading">
                                <div class="panel-title">
                                    <span class="glyphicon glyphicon-th-list"></span> 菜品类型列表<span class="col-md-offset-8"></span>
                                </div>
                            </div>
                            <div class="panel-body ">
                            	<div class="list-group ">
			                        <table class="table table-bordered text-center">
						                <tr>
						                    <td>序号</td>
						                    <td>类型名称</td>
						                    <td>所有菜品</td>
						                    <td>操作方式</td>
						                </tr>
						                <?php foreach ($type as $type){?>
					                <tr>
					                    <td><?php echo $type['id']?></td>
					                    <td><?php echo $type['name']?></td>
					                    <td><a>查看</a></td>
					                    <td>
					                        <a href="dishEdit.php?id=<?php echo $type['id'];?>">修改</a>|
					                        <a href="#delete<?php echo $type['id'];?>" data-toggle="modal">删除</a>
					                     <div class="modal fade" id="delete<?php echo $type['id']?>" tabindex="-1" >
				                        	<div class="modal-dialog">
				                        		<div class="modal-content">
				                        			<div class="modal-header">
				                        				<button type="button" class="close" data-dismiss="modal">
				                        					<span>&times;</span><span class="sr-only">Close</span>
				                        				</button>
				                        				<h4 class="modal-title">确定删除<?php echo $type['name']?></h4>
				                        			</div>
				                        			<div class="modal-body">
				                        			     你确定要删除餐桌<?php echo $type['name']?>吗？
				                        			</div>
				                        			<div class="modal-footer">
				                        				<a type="button" class="btn btn-default" href="doDeleteDish.php?id=<?php echo $type['id']?>">确定</a>
				                        				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
				                        			</div>
				                        		</div>
				                        	</div>
				                        </div>
					                    </td>
					                </tr>
				                <?php }?>
						            </table>
			                    </div>
                            </div>
	                </div>
            	</div>
            </div>
        </div>
   </body>
</html>